<%@ Language=VBScript%>
 <%
	Session("FormName")="F38"
%>
<!--#include file=..\checkSession.inc-->
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>New Page 2</title>
</head>
<!--#include file=..\jvGrid.inc-->
<!--#include file=..\vbFunction.inc-->
<!--#include file="..\pageSelected.inc"-->
<!--#include file=..\funTab.inc-->
<%			
	Set ClsFun=server.CreateObject("Vinalines.ClsFunction")	
	bMaDonVi=Request("bMaDonVi")
	bTenDonvi=Request("bTenDonvi")

	Set Rec=server.CreateObject("ADODB.Recordset") 
	rec.CursorType = 3
	rec.CacheSize=5	

	If Right(bMadonvi, 2) <> "00" Then
		strMadonvi = " canbo.madonvi ='" & bMadonvi & "'  "
	Else
		strMadonvi = " canbo.madonvi like '" & Left(bMadonvi, 4) & "%'  "
	End If
	sSQL ="select canbo.macanbo,canbo.hovaten,canbo.email,canbo.madonvi,donvi.tendonvi from canbo LEFT OUTER JOIN donvi ON canbo.madonvi=donvi.madonvi where " & strMadonvi & " order by canbo.madonvi, canbo.stt1,canbo.stt2,canbo.stt3,canbo.ten,canbo.hovaten"		
	
	Dim nRecCount	' Number of records found
	Dim nPageCount	' Number of pages of records we have
	Dim nPage	' Current page number
	nPage=CLng(request("Page"))	
	if nPage="" then nPage=1
	rec.Open ssql,Conn
	if  rec.EOF and rec.BOF then
		nPageCount=0
	end if	
%>
<!--#include file="..\jvfunction.inc"-->
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function ChangePage() {
	strURL=nhom.page.value;
	window.nhom.action=strURL;
	window.nhom.submit();
}
//-->
</SCRIPT>
<body topmargin="0" leftmargin="0" bgcolor=#F8F9D9 style="font-family:Times new roman" >
<form name="nhom" method="POST">
	<input type="hidden" name="cPage" value="<%=nPage%>">
	<input type="hidden" name="strURL" value="">
	<br>
<Div align=center><b><H2>Đơn vị: <%=bTenDonvi%></H2></b></div>
<!-- Danh sach can bo -->
<table border="0" style="BORDER-BOTTOM-STYLE: solid; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid;Border-color:#C0C0C0" WIDTH= "100%" cellspacing=1 cellpadding=1>
  <tr>
    <td width="100%" colspan="4" bgcolor="#173584"><p align="center"><b><font color="#FFFFFF" size="2">DANH SÁCH CÁN BỘ</font></b></td>
  </tr>
  <tr bgcolor="#BDD5D0">
    <td width="10%" align="center"><b>Mã</b></td>
    <td width="35%" align="center"><b>Tên cán bộ</b></td>
    <td width="15%" align="center"><b>E-Mail</b></td>
    <td width="40%" align="center"><b>Đơn vị­</b></td>
  </tr>
  	<%	
	If Not Rec.Eof Then
		nRecCount = Rec.RecordCount
		Rec.PageSize = 20
		nPageCount = Rec.PageCount
		If nPage < 1 then
			nPage = 1			
		End If
		if nPage > nPageCount Then
			nPage=nPageCount
		end if
		cnt=(pg-1)*pgsize + 1		    
		STT=1
		rec.AbsolutePage=nPage
		howmanyrecs=0
		do while not Rec.EOF and howmanyrecs<rec.PageSize
			if (cnt/2=int(cnt/2)) then
				color="#eeeecc"
			else
				color="#F8F9D9"
			end if
			bcolor="blue"
%>
			<tr id=mnu_<%=STT%> style="BORDER-RIGHT: #e7e7e7 1px solid; BORDER-TOP: #e7e7e7 1px solid; BORDER-LEFT: #e7e7e7 1px solid; COLOR: #666666; BORDER-BOTTOM: #e7e7e7 1px solid; HEIGHT: 21px; BACKGROUND-COLOR: <%=color%>" 				onmouseover="javascript:MouseOverMenu('mnu_<%=STT%>')" onmouseout="javascript:MouseOutMenu('mnu_<%=STT%>','<%=color%>')">
				  <td width="10%" height="1" style="color: <%=bColor%>"><%=Rec("Macanbo")%></td>
				  <td width="35%" height="1" style="color: <%=bColor%>"><%=Rec("Hovaten")%></td>
				  <td width="15%" height="1" style="color: <%=bColor%>"><%=Rec("email")%></td>
				  <td width="40%" height="1" style="color: <%=bColor%>"><%=funTab(Rec("madonvi"))%><%=Rec("tendonvi")%></td> 
			</tr>
<%			STT=STT+1
			Rec.MoveNext
			cnt=cnt+1
			howmanyrecs=howmanyrecs+1
		loop
	end if
	rec.Close
	set rec=nothing	
%>  
  </TR>
</table>

 <!-- Phan trang -->
<br>
<table width="98%" cellspacing=0 cellpadding=0>
<tr>
<% if nPage > 0 and nPageCount >0  then %>  
	<td width="20%"><b>Trang&nbsp; <%=nPage%>/<%=nPageCount%></b></td>
	<td width= "80%" align="right">
	<% if nPageCount > 1 then %>    
		Chuyển nhanh tới trang:&nbsp;
		<select name="page" style="width:45;height:23;font-size:8pt" size=1 onchange="javaScript:ChangePage()">
			<% for i = 1 to nPageCount%>	
				<% 
						strURL="frmDscanbo.asp?page="+ cstr(i) + "&bMaDonVi="+bMaDonVi+"&bTenDonvi="+bTenDonvi
				%>
				<option value="<%=strURL%>" <%=chkSelected(i, nPage)%>><%=i%></option>
			<% next %>    
		</select>
		</td>                                  
	<% end if %>             
<% end if %>
</tr>
</table>
</body>
</form>
</html>
<%
	Conn.Close
	Set Conn=nothing
	set ClsFun=nothing
%>